﻿using BCEntity.Common.Wallet;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace BCData.Common.Wallet
{
    /// <summary>
    /// 钱包
    /// </summary>
    public interface IWalletData
    {
        /// <summary>
        /// 创建钱包
        /// </summary>
        /// <param name="entity">钱包信息</param>
        /// <returns></returns>
        WalletEntity Add(WalletEntity entity);
        /// <summary>
        /// 更新钱包
        /// </summary>
        /// <param name="entity">钱包信息</param>
        /// <returns></returns>
        WalletEntity Update(WalletEntity entity);
        /// <summary>
        /// 获取分页钱包列表
        /// </summary>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        /// <param name="dataCount">数据总数</param>
        /// <param name="userId">用户Id</param>
        /// <returns></returns>
        IEnumerable<WalletEntity> GetPageableList(int pageIndex, int pageSize, out int dataCount, long? userId);
        /// <summary>
        /// 获取钱包信息
        /// </summary>
        /// <param name="walletId">钱包Id</param>
        /// <returns></returns>
        WalletEntity Get(long walletId);
        /// <summary>
        /// 获取钱包
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns></returns>
        WalletEntity GetWalletByUserId(long userId);
        /// <summary>
        /// 重置支付密码
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="payPwd">支付密码</param>
        /// <returns></returns>
        WalletEntity ResetPayPassword(long userId, string payPwd);
        /// <summary>
        /// 修改阿里支付授权信息
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="aliPayAuthInfo">阿里支付授权信息</param>
        /// <returns></returns>
        int ChangeAliPayAuthInfo(long userId, string aliPayAuthInfo);
        /// <summary>
        /// 修改微信支付授权信息
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="wxPayAuthInfo">微信支付授权信息</param>
        /// <returns></returns>
        int ChangeWxPayAuthInfo(long userId, string wxPayAuthInfo);
        /// <summary>
        /// 余额充值
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="rechargeAmount">充值金额</param>
        /// <returns></returns>
        WalletEntity BalanceRecharge(long userId, decimal rechargeAmount);
        /// <summary>
        /// 修改密码错误次数
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="passwordErrorCount">密码错误次数</param>
        /// <returns></returns>
        Task<WalletEntity> UpdatePasswordErrorCount(long userId, int passwordErrorCount);
        /// <summary>
        /// 清理密码错误次数--自动任务使用
        /// </summary>
        /// <returns></returns>
        void ClearErrorCount();
        
    }
}
